package com.yxzr.youyou.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by yinxu on 2018-11-09.
 */

public class TablayoutFragmentAdapter extends FragmentPagerAdapter {
    private ArrayList<Fragment> mFragments = new ArrayList<>();
    private String[] mTitle;
    public TablayoutFragmentAdapter(FragmentManager fm, String[] title, ArrayList<Fragment> frag) {
        super(fm);
        mTitle = title;
        mFragments = frag;
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitle[position];
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }
}
